<?php
namespace Plu\Library\Models\Platform\Live;

use Phalcon\Mvc\Model,
    Phalcon\Db\Column;

 class KsyunLiveSource extends Model{
 	public function initialize() {
        $this->setConnectionService('db.platform.slave');
    }

    public function getSource() {
        return 'KsyunLiveSource';
    }

    public function getRoomIdByStreamId($streamId){
        $item = self::findFirst(array(
            "StreamId = :streamId:",
            "bind" => array(
                'streamId'=> $streamId,
            ),
            'order'	=> "Id DESC"
        ));
        if(empty($item)){
        	return [];
        }else{
        	return $item->toArray();
        }
    }
 }
?>